#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;
int main()
{
    const int A = 5000;
    int a1[A], a2[A], a3[A], b = 0;
    ifstream fin ("m1_sorted.txt");
    for(int i=0; i < A; i++) fin >> a1[i];
    fin.close();
    ifstream ("m2_reverse.txt");
    for(int i=0; i < A; i++) fin >> a2[i];
    fin.close();
    ifstream ("m3_shuffle.txt");
    for(int i=0; i < A; i++) fin >> a3[i];
    fin.close();
    unsigned int d1 = clock();
    for (int i = 0; i < A; i++, b = 0){
        for (int j = 0; j < A; j++){
            if (a1[j] > a1[j + 1]){
                int b = a1[j];
                a1[j] = a1[j + 1];
                a1[j + 1] = b;
                b = 1;
            }
        }
        if (b == 0) break;
    }
    unsigned int c1 = clock();
    unsigned int e1 = c1 - d1;
    cout<<"m1_sorted " << e1 << " milliseconds \n";
    unsigned int d2 = clock();
    for (int i = 0; i < A; i++, b = 0){
        for (int j = 0; j < A; j++){
            if (a2[j] > a2[j + 1]){
                int b = a2[j];
                a2[j] = a2[j + 1];
                a2[j + 1] = b;
                b = 1;
            }
        }
        if (b == 0) break;
    }
    unsigned int c2 = clock();
    unsigned int e2 = c2 - d2;
    cout<<"m2_reverse " << e2 << " milliseconds \n";
    unsigned int d3 = clock();
    for (int i = 0; i < A; i++, b = 0){
        for (int j = 0; j < A; j++){
            if (a3[j] > a3[j + 1]){
                int b = a3[j];
                a3[j] = a3[j + 1];
                a3[j + 1] = b;
                b = 1;
            }
        }
        if (b == 0) break;
    }
    unsigned int c3 = clock();
    unsigned int e3 = c3 - d3;
    cout<<"m3_shuffle " << e3 << " milliseconds \n";
    return 0;
}
